-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(x): replace fmt.Errorf
without parameters with errors.New
#21032
Conversation
WalkthroughWalkthroughThe recent changes enhance error handling across multiple components by replacing formatted error messages created with Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (14)
- x/bank/client/cli/tx.go (2 hunks)
- x/distribution/keeper/delegation.go (2 hunks)
- x/distribution/types/params.go (2 hunks)
- x/evidence/types/genesis.go (2 hunks)
- x/feegrant/basic_fee.go (2 hunks)
- x/feegrant/filtered_fee.go (3 hunks)
- x/genutil/client/cli/export_test.go (3 hunks)
- x/genutil/utils.go (3 hunks)
- x/gov/client/cli/util.go (2 hunks)
- x/gov/keeper/common_test.go (2 hunks)
- x/group/client/cli/util.go (2 hunks)
- x/group/internal/math/dec.go (4 hunks)
- x/group/internal/orm/iterator.go (12 hunks)
- x/group/keeper/msg_server_test.go (5 hunks)
Files skipped from review due to trivial changes (7)
- x/bank/client/cli/tx.go
- x/distribution/keeper/delegation.go
- x/evidence/types/genesis.go
- x/gov/client/cli/util.go
- x/gov/keeper/common_test.go
- x/group/client/cli/util.go
- x/group/keeper/msg_server_test.go
Additional context used
Path-based instructions (7)
x/distribution/types/params.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/feegrant/basic_fee.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/group/internal/math/dec.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/utils.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/feegrant/filtered_fee.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/client/cli/export_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"x/group/internal/orm/iterator.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Learnings (1)
x/genutil/utils.go (1)
Learnt from: kocubinski PR: cosmos/cosmos-sdk#20693 File: x/genutil/utils.go:90-98 Timestamp: 2024-06-17T14:24:24.870Z Learning: BLS key types do not support mnemonic-based initialization, and this is correctly handled by returning an error message in the `InitializeNodeValidatorFilesFromMnemonic` function.
Additional comments not posted (28)
x/distribution/types/params.go (2)
4-4
: Importerrors
package is appropriate.The import of the
errors
package is necessary for the new error handling method.
32-32
: Simplified error creation witherrors.New
.The change from
fmt.Errorf
toerrors.New
for a simple error message is appropriate and improves readability.x/feegrant/basic_fee.go (2)
5-5
: Importerrors
package is appropriate.The import of the
errors
package is necessary for the new error handling method.
31-31
: Simplified error creation witherrors.New
.The change from
fmt.Errorf
toerrors.New
for a simple error message is appropriate and improves readability.x/group/internal/math/dec.go (9)
5-5
: Importerrors
package is appropriate.The import of the
errors
package is necessary for the new error handling method.
10-10
: Importgrouperrors
package is appropriate.The import of the
grouperrors
package is necessary for the new error wrapping method.
26-26
: Consistent error wrapping withgrouperrors.ErrInvalidDecString
.The change to use
grouperrors.ErrInvalidDecString.Wrap
improves consistency in error handling.
29-29
: Consistent error wrapping withgrouperrors.ErrInvalidDecString.Wrapf
.The change to use
grouperrors.ErrInvalidDecString.Wrapf
improves consistency in error handling.
37-37
: Consistent error wrapping withgrouperrors.ErrInvalidDecString
.The change to use
grouperrors.ErrInvalidDecString.Wrap
improves consistency in error handling.
40-40
: Consistent error wrapping withgrouperrors.ErrInvalidDecString.Wrapf
.The change to use
grouperrors.ErrInvalidDecString.Wrapf
improves consistency in error handling.
54-54
: Consistent error wrapping withgrouperrors.ErrInvalidDecString
.The change to use
grouperrors.ErrInvalidDecString.Wrap
improves consistency in error handling.
58-58
: Consistent error wrapping withgrouperrors.ErrInvalidDecString.Wrapf
.The change to use
grouperrors.ErrInvalidDecString.Wrapf
improves consistency in error handling.
139-139
: Simplified error creation witherrors.New
.The change from
fmt.Errorf
toerrors.New
for a simple error message is appropriate and improves readability.x/genutil/utils.go (2)
64-64
: Simplified error handling witherrors.New
.The change from
fmt.Errorf
toerrors.New
simplifies the error handling for the invalid mnemonic case.
107-107
: Simplified error handling witherrors.New
.The change from
fmt.Errorf
toerrors.New
simplifies the error handling for the unsupported BLS key type case.x/feegrant/filtered_fee.go (2)
103-103
: Simplified error handling witherrors.New
.The change from
fmt.Errorf
toerrors.New
simplifies the error handling for the environment not set case.
123-123
: Simplified error handling witherrors.New
.The change from
fmt.Errorf
toerrors.New
simplifies the error handling for the environment not set case.x/genutil/client/cli/export_test.go (2)
167-167
: Simplified error handling witherrors.New
.The change from
fmt.Errorf
toerrors.New
simplifies the error handling for the panic case inmockExporter.Export
.
314-314
: Simplified error handling witherrors.New
.The change from
fmt.Errorf
toerrors.New
simplifies the error handling for the error case inTestExportCLI
.x/group/internal/orm/iterator.go (9)
23-23
: LGTM! Comment update aligns with the new error handling strategy.The comment accurately reflects the new error handling using
grouperrors.ErrORMIteratorDone
.
38-41
: LGTM! Improved error handling.The changes use
errorsmod.Wrap
andgrouperrors
to provide more context and align with the new error management strategy.
51-51
: LGTM! Aligned with new error handling strategy.The function now uses
grouperrors.ErrORMInvalidIterator
for error reporting.
66-69
: LGTM! Improved error handling.The changes use
errorsmod.Wrap
andgrouperrors.ErrORMInvalidArgument
to provide more context and align with the new error management strategy.
75-79
: LGTM! Aligned with new error handling strategy.The function now uses
grouperrors.ErrORMIteratorDone
for error reporting.
94-94
: LGTM! Improved error handling.The changes use
errorsmod.Wrap
andgrouperrors.ErrORMInvalidArgument
to provide more context and align with the new error management strategy.
Line range hint
139-150
:
LGTM! Improved error handling.The changes use
errors.New
anderrorsmod.Wrap
to provide more context and align with the new error management strategy.
240-240
: LGTM! Improved error handling.The changes use
errorsmod.Wrap
andgrouperrors.ErrORMInvalidArgument
to provide more context and align with the new error management strategy.
279-302
: LGTM! Improved error handling.The changes use
errorsmod.Wrap
andgrouperrors.ErrORMInvalidArgument
to provide more context and align with the new error management strategy.
* main: (48 commits) build(deps): add missing replaces and remove unnecessary ones (#21033) build(deps): Bump bufbuild/buf-setup-action from 1.34.0 to 1.35.0 (#21028) chore: fix some comments for struct field (#21027) chore(x): replace `fmt.Errorf` without parameters with `errors.New` (#21032) chore: fix errors reported by running `make lint` (#21015) ci: skip spelling check in go.mod/go.sum (#21021) chore(all)!: use gogoproto/any instead of codec/types/any (#21013) chore(server/v2/cometbft): ensure consistent dash-case in app.toml (#21018) docs(server): wrong function comments (#21017) refactor(storev2): update snapshot manager and migration manager tests (#20441) feat(server/v2/cometbft): config (#20989) refactor: set `help` as default target of Makefile (#21011) fix(simapp): duplicated import (#21014) chore(docs): fix functions and struct comments (#21010) fix(simapp/v2): panic with testnet init-files command (#21012) fix: make help won't work (#21005) fix: NewIntegrationApp does not write default genesis to state (#21006) chore(x/staking,x/upgrade): replace `fmt.Errorf` without parameters with `errors.New` (#21004) chore: prepare depinject 1.0.0 (#21001) docs: Fix typos in RFC Creation Process (#20998) ...
Similar to #21004
This PR cleans all
fmt.Errorf
without parameters underx
folder.Summary by CodeRabbit
Bug Fixes
Refactor